package com.qdlc.p2p.manage.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.ScoreLogService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.common.util.StringUtil;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.ScoreLogModel;

/**
 * 积分记录管理
 * @author xxx
 * @version 2.0
 * @date 2015年6月15日 下午8:21:28
 */
public class ManageScoreLogAction extends BaseAction<ScoreLogModel> implements ModelDriven<ScoreLogModel> {
	
	@Resource
	private ScoreLogService scoreLogService;
	
	private Map<String, Object> data;
	
	/**
	 * 跳转积分日志列表页
	 * @return
	 */
	@Action("/modules/user/score/log/manage")
	public String manage() throws Exception{
		return "manage";
	}
	
	/**
	 * 积分日志分页
	 * @return
	 */
	@Action("/modules/user/score/log/list")
	public void list() throws Exception {
		if(StringUtil.isBlank(paramString("behavior"))){
			model.setBehavior(99);
		}
		PageDataList<ScoreLogModel> page = scoreLogService.findPageList(model);
		data = new HashMap<String, Object>();
		data.put("total", page.getPage().getTotal()); // 总行数
		data.put("rows", page.getList()); // 集合对象
		printJson(getStringOfJpaObj(data));
	}
	

}
